package io.renren.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.dao.ArticleCommentDao;
import io.renren.dto.ArticleEvaluateDto;
import io.renren.entity.ArticleComment;
import io.renren.service.ArticleCommentService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("articleCommentService")
public class ArticleCommentServiceImpl extends ServiceImpl<ArticleCommentDao, ArticleComment> implements ArticleCommentService {

    @Override
    public PageUtils queryPage( Map<String, Object> params ) {
        EntityWrapper<ArticleComment> entityWrapper =  new EntityWrapper<>();
        entityWrapper.eq("is_deleted", 0 );
        entityWrapper.orderBy("create_time", true );
        Page<ArticleComment> page = this.selectPage(
                new Query<ArticleComment>(params).getPage(),
                entityWrapper
        );
        return new PageUtils(page);
    }

    @Override
    public int queryByArticle(int articleId) {
        return baseMapper.queryByArticle( articleId );
    }

}
